<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('雏鹰奖励列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            受益人：
                            <input type="text" name="returnAgent"/>
                        </li>
                        <li>
                            出款流水：
                            <input type="text" name="settleSerial"/>
                        </li>
                        <li>
                            返现日期：
                            <input type="text" name="returnDate"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-warning" onclick="exportExcel()" shiro:hasPermission="eagle:eagleCashbackDetalis:exportExcel">
                <i class="fa fa-edit"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var prefix = ctx + "eagle/eagleCashbackDetalis";

    $(function() {
        var options = {
            url: prefix + "/list",
            exportExcelUrl: prefix + "/exportExcel",
            modalName: "雏鹰奖励列表",
            clickToSelect: true,
            columns: [
                {
                    field: 'id',
                    title: '编号'
                },
                {
                    field: 'returnAgent',
                    title: '受益人'
                },
                {
                    field: 'returnMoney',
                    title: '返现金额'
                },
                {
                    field: 'returnTax',
                    title: '税额'
                },
                {
                    field: 'returnTaxMoney',
                    title: '税后返现金额'
                },
                {
                    field: 'tax',
                    title: '税点'
                },
                {
                    field: 'returnDate',
                    title: '返现时间'
                },
                {
                    field: 'settleSerial',
                    title: '出款流水'
                },
                {
                    field: 'bindNum',
                    title: '绑定台数(档位)'
                },
                {
                    field: 'standardNum',
                    title: '达标台数(档位)'
                }]
        };
        $.table.init(options);
    });

    /**
     * 导出雏鹰计划奖励列表
     */
    // 导出数据
    function exportExcel(formId) {
        table.set();
        $.modal.confirm("确定导出所有" + table.options.modalName + "吗？", function() {
            var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
            var params = $("#" + table.options.id).bootstrapTable('getOptions');
            var dataParam = $("#" + currentId).serializeArray();
            dataParam.push({ "name": "orderByColumn", "value": params.sortName });
            dataParam.push({ "name": "isAsc", "value": params.sortOrder });
            $.modal.loading("正在导出数据，请稍后...");
            $.post(table.options.exportExcelUrl, dataParam, function(result) {
                if (result.code == web_status.SUCCESS) {
                    window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
                } else if (result.code == web_status.WARNING) {
                    $.modal.alertWarning(result.msg)
                } else {
                    $.modal.alertError(result.msg);
                }
                $.modal.closeLoading();
            });
        });
    }
</script>
</body>
</html>